<template>
  <div class="caixi">
    <div class="caixifenlei" @click="fn">*菜式</div>
    <!-- 小分类 -->
    <div class="caishifenlei1" ref="caishifenlei1">
      <div v-for="(el,index) in arr4" :key="index">
        <div class="caishifenlei2">{{ el }}</div>
      </div>
    </div>
    <div class="caixifenlei" @click="fn2">*特殊场合</div>
    <!-- 小分类 -->
    <div class="changhe" ref="changhe">
      <div v-for="(el,index) in arr4" :key="index">
        <div class="caishifenlei2">{{ el }}</div>
      </div>
    </div>
    <div class="caixifenlei" @click="fn3">*特色食品</div>
    <!-- 小分类 -->
    <div class="tese" ref="tese">
      <div v-for="(el,index) in arr4" :key="index">
        <div class="caishifenlei2">{{ el }}</div>
      </div>
    </div>
    <div class="caixifenlei" @click="fn4">*功效</div>
    <!-- 小分类 -->
    <div class="gongxiao" ref="gongxiao">
      <div v-for="(el,index) in arr4" :key="index">
        <div class="caishifenlei2">{{ el }}</div>
      </div>
    </div>
    <div class="caixifenlei" @click="fn5">*人群</div>
    <!-- 小分类 -->
    <div class="renqun" ref="renqun">
      <div v-for="(el,index) in arr4" :key="index">
        <div class="caishifenlei2">{{ el }}</div>
      </div>
    </div>
    <div class="caixifenlei" @click="fn6">*视频专访</div>
    <!-- 小分类 -->
    <div class="shiping" ref="shiping">
      <div v-for="(el,index) in arr4" :key="index">
        <div class="caishifenlei2">{{ el }}</div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      arr4: [
        "菜单",
        "菜单",
        "菜单",
        "菜单",
        "菜单",
        "菜单",
      ],
    };
  },
  methods: {
    fn() {
      let caishifenlei1 = this.$refs.caishifenlei1;
      //   console.log(caixifenlei1.style);
      // caixifenlei1.style.display = 'none'
      console.log(11111);
      if (caishifenlei1.style.display == "block") {
        caishifenlei1.style.display = "none";
      } else {
        caishifenlei1.style.display = "block";
      }
      
    },fn2() {
      let changhe = this.$refs.changhe;
      //   console.log(caixifenlei1.style);
      // caixifenlei1.style.display = 'none'
      if (changhe.style.display == "block") {
        changhe.style.display = "none";
      } else {
        changhe.style.display = "block";
      }
      
    },fn3() {
      let tese = this.$refs.tese;
      //   console.log(caixifenlei1.style);
      // caixifenlei1.style.display = 'none'
      if (tese.style.display == "block") {
        tese.style.display = "none";
      } else {
        tese.style.display = "block";
      }
      
    },fn4() {
      let gongxiao = this.$refs.gongxiao;
      //   console.log(caixifenlei1.style);
      // caixifenlei1.style.display = 'none'
      if (gongxiao.style.display == "block") {
        gongxiao.style.display = "none";
      } else {
        gongxiao.style.display = "block";
      }
      
    },fn5() {
      let renqun = this.$refs.renqun;
      //   console.log(caixifenlei1.style);
      // caixifenlei1.style.display = 'none'
      if (renqun.style.display == "block") {
        renqun.style.display = "none";
      } else {
        renqun.style.display = "block";
      }
    },
    fn6() {
      let shiping = this.$refs.shiping;
      //   console.log(caixifenlei1.style);
      // caixifenlei1.style.display = 'none'
      if (shiping.style.display == "block") {
        shiping.style.display = "none";
      } else {
        shiping.style.display = "block";
      }
      
    },

  },
};
</script>

<style  scoped>
.caixi {
  border-bottom: 1px solid rgb(243, 243, 243);
}
.caixifenlei {
  color: rgb(144, 144, 144);
  /* background-color: rosybrown; */
  height: 40px;
  width: 150px;
  line-height: 40px;
  border-top: 1px solid rgb(243, 243, 243);
  cursor: pointer;
}
.caishifenlei1,.changhe,.tese,.gongxiao,.renqun,.shiping{
    display: none;
}


.caixifenlei:hover {
  background-color: rgb(233, 230, 230);
  color: rgb(70, 70, 70);
}
.caishifenlei2 {
    margin-left: 20px;
  height: 30px;
  line-height: 30px;
  color: rgb(144, 144, 144);
  font-size: 15px;
  cursor: pointer;
}
.caishifenlei2:hover {
  color: rgb(223, 55, 55);
}
</style>